/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "COLOURS")
@XmlRootElement
@NamedQueries(
  {
    @NamedQuery(name = "Colours.findAll", query = "SELECT c FROM Colours c"),
    @NamedQuery(name = "Colours.findByIdColour", query = "SELECT c FROM Colours c WHERE c.idColour = :idColour"),
    @NamedQuery(name = "Colours.findByNameColour", query = "SELECT c FROM Colours c WHERE c.nameColour = :nameColour")
  })
public class Colours implements Serializable
{
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_COLOUR")
    private Integer idColour;
    @Column(name = "NAME_COLOUR")
    private String nameColour;

    public Colours()
    {
    }

    public Colours(Integer idColour)
    {
        this.idColour = idColour;
    }

    public Integer getIdColour()
    {
        return idColour;
    }

    public void setIdColour(Integer idColour)
    {
        Integer oldIdColour = this.idColour;
        this.idColour = idColour;
        changeSupport.firePropertyChange("idColour", oldIdColour, idColour);
    }

    public String getNameColour()
    {
        return nameColour;
    }

    public void setNameColour(String nameColour)
    {
        String oldNameColour = this.nameColour;
        this.nameColour = nameColour;
        changeSupport.firePropertyChange("nameColour", oldNameColour, nameColour);
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idColour != null ? idColour.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Colours))
          {
            return false;
          }
        Colours other = (Colours) object;
        if ((this.idColour == null && other.idColour != null) || (this.idColour != null && !this.idColour.equals(other.idColour)))
          {
            return false;
          }
        return true;
    }

    @Override
    public String toString()
    {
        return "model.Colours[ idColour=" + idColour + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener)
    {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener)
    {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
